import 'dart:async';

import 'package:flutter_stort/model/banner_entity.dart';

class BannerDao {
  static var images = [
    "https://img.99ym.cn/d/bizhi/202007/dhkbjdvkchj.jpg",
    "https://img.99ym.cn/d/bizhi/202007/uwyrtnzocm3.jpg",
    "http://pic.4j4j.cn/upload/pic/20130415/03a5dc2722.jpg",
    "http://pic.4j4j.cn/upload/pic/20140402/6a99cfe8ee.jpg",
    "http://pic.4j4j.cn/upload/pic/20120921/86d64249c5.jpg",
  ];
  static var goodsImags = [
    "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608285795593&di=031de57758500aea2444f2ae2fd773b1&imgtype=0&src=http%3A%2F%2Fimage2.suning.cn%2Fb2c%2Fcatentries%2F000000000121054307_1_800x800.jpg",
    "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2979316776,1106496257&fm=26&gp=0.jpg",
    "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608285795593&di=4db418d09c98b70419d24533c4bee1ed&imgtype=0&src=http%3A%2F%2Fgfs17.gomein.net.cn%2FT1a.xTB4_v1RCvBVdK_800.jpg",
    "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608285795593&di=2e948520ea3eb48f037ab2d3f32947f9&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F16%2F07%2F06%2F05577c2ce29f9ff.jpg",
    "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608285795593&di=de54b47573044f3fb9eea6522997162a&imgtype=0&src=http%3A%2F%2Fgfs17.gomein.net.cn%2FT1b.DTBKJv1RCvBVdK_800.jpg",
  ];

  ///首页轮播图
  static Future<List<BannerEntity>> getBanner() async {
    List<BannerEntity> listData = List<BannerEntity>();
    for (var i = 0; i < images.length; i++) {
      listData.add(
        BannerEntity(
          title: "标题 $i",
          id: "${i + 1}",
          url: images[i],
          createTime: "",
        ),
      );
    }
    return listData;
  }

  ///获取商品详情轮播图
  static Future<List<BannerEntity>> getDetailsBanner(int id) async {
    List<BannerEntity> listData = List<BannerEntity>();
    for (var i = 0; i < goodsImags.length; i++) {
      listData.add(
        BannerEntity(
          title: "标题 $i",
          id: "${i + 1}",
          url: goodsImags[i],
          createTime: "",
        ),
      );
    }
    return listData;
  }
}
